﻿using Fetches.Fetch.Factory;
using FetchesDeploy.Distributed.Factory;
using Microsoft.AspNetCore.Mvc;

namespace FetchesDeploy.ScalableFactory.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class SystemController:ControllerBase
    {
        [HttpGet("restart")]
        public void Restart()
        {
            
        }

        [HttpGet("factory_config")]
        public FactoryConfig GetFactoryConfig()
        {
            return ScalableFetchFactory.Instance.CurrentFactoryConfig;
        }

        [HttpPost("factory_config")]
        public string SetFactoryConfig(FactoryConfig config)
        {
            ScalableFetchFactory.Instance.ChangeFactoryConfig(config);
            return "success";
        }

        [HttpGet("rebuild")]
        public void Rebuild()
        {
            ScalableFetchFactory.Instance.Rebuild();
        }
    }
}
